package com.hdyg.sixg.mvp.presenter;

import com.hdyg.sixg.entry.BuyMiniBean;
import com.hdyg.sixg.httpUtil.HttpCallback;
import com.hdyg.sixg.mvp.Contrant.CBuyMini;
import com.hdyg.sixg.mvp.base.BasePresenter;
import com.hdyg.sixg.util.ToastUtil;
import java.util.Map;

/**
 * @author CZB
 * @describe 购买矿机支付页面
 * @time 2019/4/10 9:54
 */
public class PBuyMini extends BasePresenter implements CBuyMini.IPBuyMini {

    private CBuyMini.IVBuyMini mView;

    public PBuyMini(CBuyMini.IVBuyMini mView) {
        this.mView = mView;
    }

    @Override
    public void pGetInit(String path, Map<String, String> params) {
        mModel.post(path, params, new HttpCallback<BuyMiniBean>(true) {
            @Override
            public void onSuccess(BuyMiniBean loginBean) {
                mView.vGetInitSuccess(loginBean);
            }

            @Override
            public void onFail(String code, String error) {
                ToastUtil.show(error);
            }
        });
    }

    @Override
    public void pGetPay(String path, Map<String, String> params) {
        mModel.post(path, params, new HttpCallback(true) {
            @Override
            public void onSuccess(Object loginBean) {
                mView.vGetPaySuccess(loginBean.toString());
            }

            @Override
            public void onFail(String code, String error) {
                ToastUtil.show(error);
            }
        });
    }
}
